import r from './axios'

/**
 * 登录
 * @param data
 */
export function login(data: any) {
    return r.post('/user/login', data)
}

/**
 * 注册
 * @param data
 */
export function regrpt(data: any) {
    return r.post('/user/login/register', data)
}

/**
 * 找回密码
 * @param data
 */
export function forgt(data: any) {
    return r.post('/user/login/forget', data)
}

/**
 * 获取旅游路线
 */
export function mainRoute(params: any) {
    return r.get('/user/main/route', {params})
}

/**
 * 获取旅游资讯
 */
export function mainNews(params: any) {
    return r.get('/user/main/news', {params})
}

/**
 * 获取景点
 */
export function mainAttraction(params: any) {
    return r.get('/user/main/attraction', {params})
}

/**
 * 获取资讯详情
 * @param id
 */
export function mainNewsDetail(id: any) {
    return r.get(`/user/main/news/detail/${id}`)
}

/**
 * 取消收藏
 */
export function putAttr(params: any) {
    return r.put(`/user/attr`, params)
}

/**
 * 添加收藏
 */
export function mainattr(params: any) {
    return r.post(`/user/attr`, params)
}

/**
 * 路线详情
 * @param id
 */
export function mainRouteDetailById(id: any) {
    return r.get(`/user/main/route/detail/${id}`)
}

/**
 * 添加评论
 * @param data
 */
export function addComment(data: any) {
    return r.post('/user/main/comment/add', data)
}

/**
 * 评论分页
 * @param params
 */
export function mainCommentPage(params: any) {
    return r.get('/user/main/comment', {params})
}

export function mainAttractionDetail(id: any) {
    return r.get(`/user/main/attraction/detail/${id}`)
}

/**
 * 收藏分页查询
 */
export function getUserAttr(params: any) {
    return r.get('/user/attr', {params})

}

/**
 * 修改用户信息
 */
export function postUserInfo(data: any) {
    return r.post('/user/info', data)
}

/**
 * 查询用户信息
 */
export function getUserInfo() {
    return r.get('/user/info')
}

export function getCategoryApi(params: { page: number, size: number, type: string }) {
    return r.get('/user/main/category', {params})
}
